﻿//-----------------------------------------------------------------
//
// @(#)$Id: DisputeDetail.aspx.cs,v 1.0 2013/12/13 16:58:44 lichunhua Exp $
// @(#)$Author: lichunhua  $
// @(#)$Date: 2013/12/13 16:58:44 $
// @(#)$Description:
//
//
//
//                 All Rights Reserved.
//-----------------------------------------------------------------
using System;
using System.Data;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using ebay.Dal.CenterDB_EbayTableAdapters;

public partial class UI_Bas_DisputeDetail : System.Web.UI.Page
{
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);      
    }

    static string act = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
       {            
            act = Request.QueryString["act"];
            if (!string.IsNullOrEmpty(act))
            {
                switch (act)
                {
                    case "view":
                        string disputeID = Request.QueryString["id"];
                        string ebayUserId = Request.QueryString["id2"];
                        tid1.Value = disputeID;
                        tid2.Value = ebayUserId;
                        T_EbayDisputeTableAdapter ebayAdapter = new T_EbayDisputeTableAdapter();

                        DataTable dt = ebayAdapter.GetDataById(ebayUserId, disputeID);
                        DataRow r = dt.Rows[0];                        
                        if (dt.Rows.Count > 0)
                        {
                            foreach (Control txtControl in this.form1.Controls)
                            {
                                if (txtControl is HtmlInputText )
                                {
                                    HtmlInputText txtBox = (HtmlInputText)txtControl;
                                    string colName = txtBox.ID.Substring(3, txtBox.ID.Length - 3);
                                    txtBox.Value = r[colName].ToString();
                                }
                                else if (txtControl is HtmlSelect )
                                {
                                    HtmlSelect ddList = (HtmlSelect)txtControl;
                                    string colName = ddList.ID.Substring(3, ddList.ID.Length - 3);
                                    ddList.Value = r[colName].ToString();
                                }
                            }
                        }                       
                        break;
                }
            }
        }
    }  
}  